package com.leen.admin.controller;

import com.leen.admin.dto.DictDTO;
import com.leen.admin.entity.Dict;
import com.leen.admin.service.CrudService;
import com.leen.admin.service.DictService;
import com.leen.common.vo.ResponseVO;
import com.leen.common.vo.ResultEnum;
import com.leen.common.vo.ResultVO;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author yy
 */
@RestController
@Api(tags = "字典API")
@RequestMapping(value = "/admin")
public class DictController {

    @Autowired
    private DictService dictService;

    @GetMapping(value = "/dict/search/")
    public ResultVO<ResponseVO> search(DictDTO dictDTO){
        return ResultVO.success(this.dictService.serach(dictDTO));
    }




    @PostMapping(value = "/dict/add")
    public ResultVO dictAdd(@RequestBody Dict dict){
        Object save = dictService.save(dict);
        return ResultVO.success(ResultEnum.DB_SUCCESS);
    }
}
